//
//  CZQTitleBtn.m
//  weibo
//
//  Created by Apple on 15-1-31.
//  Copyright (c) 2015年 itcast. All rights reserved.
//

#import "CZQTitleBtn.h"

@implementation CZQTitleBtn

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setup];
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder{
    self = [super initWithCoder:aDecoder];
    if (self) {
        [self setup];
    }
    return self;
}

- (void)setup{
    //设置颜色
    [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    //设置图片居中
    self.imageView.contentMode = UIViewContentModeCenter;
    //设置标题居中
    self.titleLabel.textAlignment = NSTextAlignmentCenter;

}
- (void)layoutSubviews{
    [super layoutSubviews];
    self.titleLabel.x = self.imageView.x;
    self.imageView.x = CGRectGetMaxX(self.titleLabel.frame)+5;

}
@end
